﻿<UserControl x:Class="WPFSolution.UserControls.InterpolationFunctionEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:localUC="clr-namespace:WPFSolution.UserControls"
             xmlns:localCon="clr-namespace:WPFSolution.Converters"
             mc:Ignorable="d"  MinHeight="300" MinWidth="500" Height="Auto"
             xmlns:my="http://schemas.AvalonControls/AvalonControlsLibrary/Controls">
    <UserControl.Resources>
    </UserControl.Resources>
    <StackPanel>
        <StackPanel Orientation="Vertical">
            <localUC:FunctionEvaluator x:Name="funcEvaluator"
                IntervalStart="{Binding ElementName=fromTextBox, Path=Text, NotifyOnSourceUpdated=True}" 
                IntervalStop="{Binding ElementName=toTextBox, Path=Text, NotifyOnSourceUpdated=True}"
                PointsNumber="{Binding ElementName=pointsNumberSlider, Path=Value, NotifyOnSourceUpdated=True}" 
                InterpolationOrder="{Binding ElementName=methodOrderTextBox, Path=Text, NotifyOnSourceUpdated=True}"
                                       ></localUC:FunctionEvaluator>
            <GroupBox Header="Interpolation Parametre">
                <Grid Grid.ColumnSpan="20" Grid.RowSpan="20" Margin="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>


                    <DockPanel Grid.Column="0" Grid.Row="0" Margin="0,0,5,0">
                        <Label DockPanel.Dock="Top" FontWeight="Normal">Number Of Points</Label>
                        <TextBox Width="100" Margin="3,0,3,0" Text="{Binding ElementName=pointsNumberSlider, Path=Value}" Name="pointsNumberTextBox" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="{x:Null}" BorderBrush="{x:Null}" FontSize="20"></TextBox>
                        <Slider TickPlacement="Both" Name="pointsNumberSlider" Maximum="1001" Minimum="101" LargeChange="100" Value="101" TickFrequency="50" SmallChange="50" IsMoveToPointEnabled="False" IsSnapToTickEnabled="True" PreviewMouseUp="PointsNumberSliderPreviewMouseUp" VerticalAlignment="Center"></Slider>
                    </DockPanel>
                    <DockPanel Grid.Column="1" Grid.Row="0" LastChildFill="False">
                        <Label DockPanel.Dock="Top">Interpolation Interval</Label>
                        <Label VerticalContentAlignment="Center">From</Label>
                        <TextBox Name="fromTextBox" Width="Auto" MinWidth="100" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" LostFocus="IntervalPointTextChanged" MouseLeave="IntervalPointTextBoxMouseLeave" FontSize="16">-1</TextBox>
                        <Label VerticalContentAlignment="Center">To</Label>
                        <TextBox Name="toTextBox" Width="Auto" MinWidth="100"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" LostFocus="IntervalPointTextChanged" MouseLeave="IntervalPointTextBoxMouseLeave" FontSize="16">1</TextBox>
                    </DockPanel>
                    <DockPanel Grid.Column="1" Grid.Row="1" Margin="0,5,0,0">
                        <Label VerticalContentAlignment="Center">Width Of The Interval</Label>
                        <TextBox IsReadOnly="True" Name="intervalWidthTextBox" Background="{x:Null}" BorderBrush="{x:Null}" VerticalContentAlignment="Center" HorizontalContentAlignment="Left" FontSize="16"></TextBox>
                    </DockPanel>
                    <DockPanel Grid.Column="0" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Stretch">
                        <DockPanel.ToolTip>
                            Minimum Value -- 3
                            Maximum Value -- 20
                        </DockPanel.ToolTip>
                        <Label Width="105" DockPanel.Dock="Top"  VerticalContentAlignment="Center" HorizontalAlignment="Left">Method Order</Label>
                        <TextBox Name="methodOrderTextBox" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="16" LostFocus="methodOrderTextBox_LostFocus" MouseLeave="methodOrderTextBox_MouseLeave">5</TextBox>
                    </DockPanel>
                    <DockPanel Grid.Column="0" Grid.Row="2" LastChildFill="True">
                        <Button Name="loadFromFileButton" Width="150" Click="loadFromFileButton_Click">Load Grid From File</Button>
                    </DockPanel>
                </Grid>
            </GroupBox>
        </StackPanel>
        <localUC:InfoLundinReference></localUC:InfoLundinReference>
    </StackPanel>
</UserControl>
